<!-- 2024年7月9日11:15:20 -->
<!-- 这里现在是原版的mine文件，原本是想拆下载报告功能的部分页面出来作为组件 -->
<!-- 但是目前校园版不需要这个功能，所以为了项目进度，先备份代码不进行组件拆分 -->
<template>
  <div class="wrapper">
    <div class="top-bar">
      <div class="title">
        <img src="../../assets/home/governmentIcon.png" @click="handleLogoClick" />
        <span @click="handleLogoClick"> {{ pageTitle }} </span>
      </div>
    </div>
    <div class="content-container">
      <searchBox ref="searchBox" :hideHistory="true"></searchBox>
      <div class="main">
        <div class="header-wrapper">
          <div class="header">
            <div class="header-item">
              <img class="back-btn" :src="backBtn" @click="handleBackBtnClick" alt="" />
            </div>
            <div class="title">
              <span class="mine">我的</span>
              <span :class="{'mineTabItem':true, 'active':mineTabSelectedValue==item.value}"
                v-for="item,index in mineTabList" :key="index" @click="handleMineTabClick(item)">{{item.name}}</span>
            </div>
          </div>
        </div>
        <div class="main-content">
          <div class="report-list">
            <div class="title">选择职业导出报告</div>
            <div class="add-btn" v-show="!showCheckBox" @click="handleAddPosition">
              <!-- <img class="add-img" :src="add" alt="" /> -->
              <i class="el-icon-plus add-img"></i>
              <span class="add-text">添加职业</span>
            </div>
            <div class="btn-bar" v-show="showCheckBox">
              <span class="btn" @click="handleSelectAll">{{
                isSelectedAll ? "全不选" : "全选"
              }}</span>
              <span class="btn ml14" @click="handleAddPosition">添加</span>
            </div>
            <div class="list" ref="list">
              <el-scrollbar ref="scrollBarRef" style="height: 100%">
                <div ref="scrollInnerRef" style="height: 100%">
                  <div v-for="(item, index) in positionList" :key="index"
                    :class="['list-item', activeClassFn(item.valueId)]">
                    <div :class="showCheckBox ? '' : 'not-visible'">
                      <el-checkbox :class="[
                          currentPositionId === item.valueId
                            ? 'custom-checkbox'
                            : '',
                        ]" v-model="item.isSelected" @change="handleSelectPosition"></el-checkbox>
                    </div>
                    <div :class="[
                        'list-item-name',
                        item.isSelected ? 'checkboxActive' : '',
                      ]" @click="handlePreviewReport(item)" :title="item.navName">
                      {{ item.navName }}
                    </div>
                    <div :class="[item.isDownloaded ? 'download-status' : '']"></div>
                  </div>
                </div>
              </el-scrollbar>
            </div>
            <div v-if="positionList.length" class="clear" @click="handleClearMyReport">
              <i class="el-icon-delete"></i>
              <span class="clear-text">{{
                `清空（${positionList.length}）`
              }}</span>
            </div>
          </div>
          <div class="preview-wrap" v-loading="previewLoading">
            <div :class="['preview-content', fileSrc ? 'shadow' : '']">
              <div class="preview-text">预览</div>
              <el-scrollbar v-if="fileSrc" ref="scrollPreviewRef" style="height: 100%;padding-bottom: 12px;
}">
                <DocPreview :fileSrc="fileSrc"></DocPreview>
              </el-scrollbar>
              <div v-else class="empty">
                <span> 如需下载职业报告，请先在左侧添加职业 </span>
              </div>
            </div>
            <div class="footer-wrapper">
              <div class="footer" v-if="positionList.length">
                <div v-if="!showCheckBox" :class="[
                    'download-btn',
                    'multiple',
                    downloadLoading ? 'producing' : '',
                  ]" @click="handleInitMultipleDownload">
                  开启批量下载
                </div>
                <div v-if="showCheckBox" :class="[
                    'download-btn',
                    'single',
                    downloadLoading ? 'producing' : '',
                  ]" @click="batchDownloadReport">
                  <span v-if="downloadLoading">批量生成中({{ selectedPositionIdList.length }})<span class="dot-ani"></span>
                  </span>
                  <span v-else>下载报告（{{ selectedPositionIdList.length }}/30）</span>
                </div>
                <div v-if="showCheckBox" :class="[
                    'download-btn',
                    'multiple',
                    'ml16',
                    downloadLoading ? 'producing' : '',
                  ]" @click="handleCloseMultipleDownload">
                  关闭批量下载
                </div>
                <div v-if="!showCheckBox" :class="[
                    'download-btn',
                    'single',
                    'ml16',
                    downloadLoading ? 'producing' : '',
                  ]" :href="fileSrc" @click="handleDownloadCurrentReport">
                  <span v-if="downloadLoading">报告生成中<span class="dot-ani"></span>
                  </span>
                  <span v-else>下载该篇报告</span>
                </div>
              </div>
            </div>
          </div>
          <div class="preview-type">
            <div class="title">报告预览类型</div>
            <div class="all-type">
              <el-checkbox v-if="showCheckBox" v-model="allReportType" @change="handleChangeAllReportType"
                :label="allReportType ? '全不选' : '全选'"></el-checkbox>
            </div>
            <div class="type-list">
              <div :class="[
                  'type-list-item',
                  item.value === currentReportType ? 'active' : '',
                ]" v-for="(item, index) in reportTypeOptions" :key="item.value">
                <el-checkbox v-if="showCheckBox" v-model="item.checked" @change="handleChangeReportType"></el-checkbox>
                <div class="type-list-item-name" @click="handleClickReportType(item)">
                  {{ `${index + 1} ${item.name}` }}
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <AddPositionDialog ref="addPositionRef" :visible.sync="addPositionVisible" :preSelectedList="positionList"
      :isSelectedAll="isSelectedAll" @confirm="handleConfirmAdd"></AddPositionDialog>
  </div>
</template>

<script>
import axios from "axios";
import FileSaver from "file-saver";
import { Notification } from "element-ui";
import searchBox from "../home/components/searchBox";
import add from "@/assets/mine/add.png";
import DocPreview from "./components/DocPreview.vue";
import AddPositionDialog from "./components/AddPositionDialog.vue";
import { queryReports, createReportsZip, queryReportsZip } from "@/api/mine";

export default {
  name: "Mine",
  components: {
    searchBox,
    DocPreview,
    AddPositionDialog,
  },
  data() {
    return {
      mineTabSelectedValue: 1,
      mineTabList: [
        {
          name: "首页",
          value: 1,
        },
        // {
        //   name: "下载中心",
        //   value: 2,
        // },
      ],
      add: add,
      count: 0,
      token: "",
      pageTitle:
        localStorage.getItem("superToken") ==
          "407404EAEC845F1B91A104B80FE86D89" ||
        localStorage.getItem("superToken") == "5FD271D8A0AA315DD218801C0C3A0DEA"
          ? "一览职业大全"
          : "职神籍",
      backBtn: require("../../icons/backBtn.png"),
      fileSrc: "",
      positionList: [],
      reportTypeOptions: [
        {
          value: "recruitment_allocation_report",
          name: "招聘配置报告",
          checked: false,
        },
        {
          value: "compensation_incentive_report",
          name: "薪酬激励报告",
          checked: false,
        },
        {
          value: "training_development_report",
          name: "培训开发报告",
          checked: false,
        },
      ],
      reportTypeList: [
        "recruitment_allocation_report",
        "compensation_incentive_report",
        "training_development_report",
      ],
      currentReportType: "recruitment_allocation_report",
      currentPositionId: "",
      showCheckBox: false,
      addPositionVisible: false,
      isSelectedAll: false,
      allReportType: false,
      previewLoading: false,
      downloadLoading: false,
      selectedPositionIdList: [],
      preDownloadUrlList: [],
      zipId: "",
      timer: null,
      requestCount: 0,
    };
  },
  mounted() {
    this.isSuperToken =
      localStorage.getItem("superToken") ==
        "407404EAEC845F1B91A104B80FE86D89" ||
      localStorage.getItem("superToken") == "5FD271D8A0AA315DD218801C0C3A0DEA";
    document.title = "我的";
    if (
      this.$route.query.superToken == "407404EAEC845F1B91A104B80FE86D89" ||
      this.$route.query.superToken == "5FD271D8A0AA315DD218801C0C3A0DEA"
    ) {
      this.specialHidden = false;
    }
  },
  created() {
    this.token = localStorage.getItem("userInfo")
      ? JSON.parse(localStorage.getItem("userInfo")).token
      : "";
    this.positionList = sessionStorage.getItem("positionList")
      ? JSON.parse(sessionStorage.getItem("positionList"))
      : [];
    this.currentPositionId = sessionStorage.getItem("ylPositionId") || "";
    this.currentReportType = sessionStorage.getItem("reportType") || "";
    this.positionList.length &&
      this.currentPositionId &&
      this.currentReportType &&
      this.queryReportsFn();
  },
  methods: {
    handleMineTabClick(item) {
      this.mineTabSelectedValue = item.value;
    },
    async handleDownloadCurrentReport() {
      if (this.downloadLoading) return;
      if (!this.positionList.length) {
        Notification.warning({
          title: "提示",
          dangerouslyUseHTMLString: true,
          message: "请先添加职业！",
        });
        return;
      }
      if (!this.currentPositionId) {
        Notification.warning({
          title: "提示",
          dangerouslyUseHTMLString: true,
          message: "请先选择一个职业！",
        });
        return;
      }
      if (!this.currentReportType) {
        Notification.warning({
          title: "提示",
          dangerouslyUseHTMLString: true,
          message: "请选择报告类型！",
        });
        return;
      }
      const params = {
        ylPositionIdList: [this.currentPositionId],
        reportTypeList: [this.currentReportType],
      };
      this.createReportsZipFn(params, 4000);
    },
    createReportsZipFn(params, timeout) {
      this.downloadLoading = true;
      createReportsZip(params)
        .then((res) => {
          if (res.code == 200) {
            this.zipId = res.data;
            this.timer = setInterval(() => {
              this.requestCount++;
              if (this.requestCount >= 4) {
                clearInterval(this.timer);
                this.downloadLoading = false;
              }
              this.queryReportsZipFn();
            }, timeout);
          }
        })
        .catch((err) => {
          Notification.error({
            title: "提示",
            dangerouslyUseHTMLString: true,
            message: err,
          });
        });
    },
    queryReportsZipFn() {
      queryReportsZip(this.zipId)
        .then((res) => {
          if (res.code == 200 && res.data && typeof res.data === "string") {
            const downloadZipUrl = res.data || "";
            // 以下三行代码是为了解决跨域问题
            const index = downloadZipUrl.indexOf(".com");
            const newUrl =
              process.env.VUE_APP_BACK_API + downloadZipUrl.slice(index + 5);
            this.download(newUrl);
            clearInterval(this.timer);
            this.downloadLoading = false;
            this.requestCount = 0;
          }
        })
        .catch((err) => {
          Notification.error({
            title: "提示",
            dangerouslyUseHTMLString: true,
            message: err,
          });
        });
    },
    download(url) {
      axios({
        url,
        method: "get",
        headers: { Authorization: this.token },
      }).then((res) => {
        if (res.data.code == 200) {
          FileSaver.saveAs(res.data.data); // 利用file-saver保存文件
          this.positionList.forEach((item) => {
            if (item.isSelected) {
              item.isDownloaded = true;
              item.isSelected = false;
            }
          });
          this.selectedPositionIdList = [];
          this.isSelectedAll = false;
        }
      });
    },
    async queryReportsFn() {
      if (this.previewLoading) return;
      this.previewLoading = true;
      const params = [
        {
          ylPositionId: this.currentPositionId,
          reportTypeList: [this.currentReportType],
        },
      ];
      const res = await queryReports(params);
      if (res.code == 200 && Array.isArray(res.data) && res.data.length) {
        // 以下三行代码是为了解决跨域问题
        const urlReport = res.data[0].reportUrl || "";
        const index = urlReport.indexOf(".com");
        const newUrl =
          process.env.VUE_APP_BACK_API + urlReport.slice(index + 5);
        this.getPreviewUrl(newUrl);
      } else {
        this.previewLoading = false;
      }
    },
    getPreviewUrl(url) {
      axios({
        url,
        method: "get",
        headers: { Authorization: this.token },
      })
        .then((res) => {
          if (res.data.code == 200) {
            this.fileSrc = res.data.data;
            this.scrollToTop();
          }
        })
        .finally(() => {
          this.previewLoading = false;
        });
    },
    handleSelectPosition() {
      this.selectedPositionIdList = this.positionList.filter(
        (item) => item.isSelected
      );
      this.watchIsSelectedAll();
    },
    watchIsSelectedAll() {
      if (this.selectedPositionIdList.length < this.positionList.length) {
        this.isSelectedAll = false;
      } else {
        this.isSelectedAll = true;
      }
    },
    handleConfirmAdd(value) {
      this.positionList = value;
      if (!this.positionList.length) {
        this.fileSrc = "";
        this.currentPositionId = "";
      }
      this.handleSelectPosition();
      this.positionList.length && this.selectFirstPosition();
      this.scrollToBottom();
      this.watchIsSelectedAll();
      sessionStorage.setItem("positionList", JSON.stringify(this.positionList));
    },
    selectFirstPosition() {
      if (!this.currentPositionId) {
        this.currentPositionId = this.positionList[0].valueId;
        this.currentReportType = this.reportTypeOptions[0].value;
        this.queryReportsFn();
      } else {
        const temp = this.positionList.find(
          (item) => item.valueId === this.currentPositionId
        );
        // 如果从弹框返回来的数据没有和目前的id对应上，证明这个职业已经没有被选中
        if (!temp) {
          this.currentPositionId = this.positionList[0].valueId;
          this.currentReportType = this.reportTypeOptions[0].value;
          this.queryReportsFn();
        }
      }
    },
    scrollToBottom() {
      this.$nextTick(() => {
        this.$refs.scrollBarRef.wrap.scrollTop =
          this.$refs.scrollInnerRef.offsetHeight;
      });
    },
    scrollToTop() {
      this.$nextTick(() => {
        this.$refs.scrollPreviewRef.wrap.scrollTop = 0;
      });
    },
    handleAddPosition() {
      this.addPositionVisible = true;
    },
    handlePreviewReport(item) {
      const { valueId } = item;
      if (this.currentPositionId === valueId) return;
      this.currentPositionId = valueId;
      this.currentReportType = this.reportTypeOptions[0].value;
      sessionStorage.setItem("ylPositionId", this.currentPositionId);
      sessionStorage.setItem("reportType", this.currentReportType);
      this.queryReportsFn();
    },
    handleSelectAll() {
      this.isSelectedAll = !this.isSelectedAll;
      this.positionList.forEach((item) => {
        item.isSelected = this.isSelectedAll;
      });
      this.handleSelectPosition();
    },
    batchDownloadReport() {
      if (this.downloadLoading) return;
      if (!this.positionList.length) {
        Notification.warning({
          title: "提示",
          dangerouslyUseHTMLString: true,
          message: "请先添加职业！",
        });
        return;
      }

      if (!this.showCheckBox) {
        this.showCheckBox = true;
        return;
      }

      if (!this.selectedPositionIdList.length) {
        Notification.warning({
          title: "提示",
          dangerouslyUseHTMLString: true,
          message: "请选择需要下载的职业！",
        });
        return;
      }

      if (this.selectedPositionIdList.length > 30) {
        Notification.warning({
          title: "提示",
          dangerouslyUseHTMLString: true,
          message: "一次性批量下载最多选择30种职业！",
        });
        return;
      }

      const selectedReportList = [];
      this.reportTypeOptions.forEach((item) => {
        if (item.checked) {
          selectedReportList.push(item.value);
        }
      });
      if (!selectedReportList.length && this.showCheckBox) {
        Notification.warning({
          title: "提示",
          dangerouslyUseHTMLString: true,
          message: "请选择需要下载的报告类型！",
        });
        return;
      }
      const selectedPositionIdList = [];
      this.positionList.forEach((item) => {
        if (item.isSelected) {
          selectedPositionIdList.push(item.valueId);
        }
      });
      const params = {
        ylPositionIdList: selectedPositionIdList,
        reportTypeList: selectedReportList,
      };
      let timeout,
        number = selectedPositionIdList.length * selectedReportList.length;
      if (number <= 5) {
        timeout = 5000;
      } else if (number > 5 && number <= 10) {
        timeout = 8000;
      } else {
        timeout = number * 1500;
      }
      this.createReportsZipFn(params, timeout);
    },
    handleDownloadZip() {},
    handleClickReportType(item) {
      if (!this.positionList.length) {
        Notification.warning({
          title: "提示",
          dangerouslyUseHTMLString: true,
          message: "请先添加职业！",
        });
        return;
      }
      this.currentReportType = item.value;
      this.queryReportsFn();
      sessionStorage.setItem("reportType", this.currentReportType);
    },
    handleCloseMultipleDownload() {
      if (this.downloadLoading) return;
      this.showCheckBox = false;
      this.isSelectedAll = false;
      this.positionList.forEach((item) => {
        item.isSelected = false;
      });
      this.reportTypeOptions.forEach((item) => {
        item.checked = false;
      });
    },
    handleInitMultipleDownload() {
      if (this.downloadLoading) return;
      this.showCheckBox = true;
      this.allReportType = true;
      this.selectedPositionIdList = [];
      this.reportTypeOptions.forEach((item) => {
        item.checked = true;
      });
    },
    handleChangeAllReportType() {
      this.reportTypeOptions.forEach((item) => {
        item.checked = this.allReportType;
      });
    },
    handleChangeReportType() {
      const temp = this.reportTypeOptions.filter((item) => item.checked);
      if (temp.length >= this.reportTypeOptions.length) {
        this.allReportType = true;
      } else {
        this.allReportType = false;
      }
    },
    handleClearMyReport() {
      this.$confirm("是否确定全部删除以上职业？", "温馨提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        callback: (action) => {
          if (action === "confirm") {
            this.showCheckBox = false;
            this.positionList = [];
            this.fileSrc = "";
            this.currentPositionId = "";
            this.currentReportType = "";
            sessionStorage.removeItem("positionList");
            sessionStorage.removeItem("ylPositionId");
            sessionStorage.removeItem("reportId");
            this.$refs.addPositionRef.clearAll();
          }
        },
      });
    },
    handleBackBtnClick() {
      this.$router.go(-1);
    },
    handleLogoClick() {
      this.$router.push({
        path: "/position",
        query: {
          superToken: this.$route.query.superToken || "",
        },
      });
    },
    activeClassFn(id) {
      if (this.currentPositionId == id && !this.showCheckBox) {
        return "active";
      } else if (this.currentPositionId == id && this.showCheckBox) {
        return "multiple-active";
      } else {
        return "";
      }
    },
  },
};
</script>
<style scoped lang="scss">
$main-color: #0b6eff;
@keyframes popupAnimation {
  0% {
    transform: translate(-50%, 100%);
    opacity: 0;
  }
  100% {
    transform: translate(-50%, -50%);
    opacity: 1;
  }
}
.wrapper {
  position: relative;
  background: #f7f8fa;
  height: 100%;
  font-size: 14px;
}

.top-bar {
  position: fixed;
  display: flex;
  align-items: center;
  height: 57px;
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(7px);
  background-size: 100% 57px;
  z-index: 2;
  .title {
    display: flex;
    align-items: center;
    padding-left: 25px;
    color: #fff;
    font-size: 17px;
    line-height: 24px;
    letter-spacing: 2px;
    font-family: "title-home-font";
    span {
      cursor: pointer;
    }
    img {
      height: 24px;
      width: auto;
      cursor: pointer;
    }
  }
}
.content-container {
  width: 100%;
  height: 100%;
  display: flex;
  background: url("../../assets/home/back.png") no-repeat;
  flex-direction: column;
  background-size: 100.1% auto;
  align-items: center;
  font-family: PingFangSC-Medium, PingFang SC;
  .main {
    height: calc(100vh - 78px);
    position: relative;
    border-radius: 20px 20px 0 0;
    margin-top: 24px;
    background-color: #f7f8fa;
    margin-left: 24px;
    margin-right: 24px;
    width: calc(100vw - 48px);
    overflow-y: hidden;
    .header-wrapper {
      padding-bottom: 18px;
      background-color: #fff;
      .header {
        display: flex;
        align-items: center;
        padding: 20px 0 6px 0;
        margin-left: 40px;
        border-bottom: 1px solid #cfd8f5;
        &-item {
          display: flex;
          align-items: center;
        }
        .back-btn {
          width: 36px;
          height: 36px;
          position: absolute;
          left: 16px;
          top: 16px;
          cursor: pointer;
        }
        .title {
          margin-left: 30px;
          .mine {
            font-size: 22px;
            color: #222;
            font-family: PingFangSC-Medium, PingFang SC;
            margin-right: 28px;
          }
          .mineTabItem {
            font-size: 16px;
            font-family: PingFangSC-Medium, PingFang SC;
            padding-bottom: 5px;
            color: #999;
            margin: 8px 26px 0;
            cursor: pointer;
            &.active {
              border-bottom: 2px solid $main-color;
              color: $main-color;
            }
          }
        }
      }
    }
    .ml14 {
      margin-left: 14px;
    }
    .main-content {
      display: flex;
      flex: 1;
      width: 100%;
      height: 100%;
      box-shadow: 0px 24px 32px -22px #d7e3f8 inset;
      .not-visible {
        visibility: hidden;
      }
      .report-list {
        width: 175px;
        height: 100%;
        flex-shrink: 0;
        background-color: #fff;
        box-shadow: 0px 30px 32px -22px #d7e3f8 inset;
        position: relative;
        .title {
          font-size: 18px;
          color: #222;
          text-align: center;
          padding: 16px 0 12px 0;
        }
        .add-btn {
          display: flex;
          justify-content: center;
          align-items: center;
          border: 1px solid $main-color;
          border-radius: 4px;
          padding: 3px 0;
          width: 145px;
          margin: 0 auto;
          cursor: pointer;
          user-select: none;
          color: $main-color;
          .add-img {
            margin-right: 8px;
            font-weight: 600;
            font-size: 14px;
          }
        }
        .btn-bar {
          display: flex;
          align-items: center;
          margin-left: 16px;
          .btn {
            padding: 3px 12px;
            border-radius: 2px;
            border: 1px solid $main-color;
            color: $main-color;
            cursor: pointer;
            user-select: none;
            &:hover {
              color: $main-color;
              border-color: $main-color;
            }
          }
        }
        .list {
          flex-shrink: 0;
          padding: 8px 0 0 0;
          height: calc(100% - 183px);
          &-item {
            display: flex;
            align-items: center;
            cursor: pointer;
            padding: 9px 0 9px 15px;
            margin: 4px 10px 4px 0;
            position: relative;
            .download-status {
              position: absolute;
              right: 8px;
              top: 8px;
              width: 5px;
              height: 5px;
              border-radius: 50%;
              background-color: #f06060;
            }
            &-name {
              font-family: Helvetica Neue, Helvetica, PingFang SC,
                Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
              overflow: hidden;
              text-overflow: ellipsis;
              white-space: nowrap;
              padding-left: 6px;
              user-select: none;
              font-size: 16px;
              flex: 1;
              color: #999;
              &:hover {
                color: $main-color;
              }
            }
            .custom-checkbox {
              // ::v-deep .el-checkbox__inner {
              //   width: 12px;
              //   height: 12px;
              //   border-radius: 3px;
              //   background: transparent;
              // }
              // ::v-deep .el-checkbox__label {
              //   padding-left: 4px;
              // }
              // ::v-deep .el-checkbox__input.is-checked .el-checkbox__inner,
              // .el-checkbox__input.is-indeterminate .el-checkbox__inner {
              //   background: transparent;
              // }
              // ::v-deep .el-checkbox__input.is-checked + .el-checkbox__label {
              //   color: #fff;
              // }
              // ::v-deep .el-checkbox__inner::after {
              //   left: 3px;
              //   height: 5px;
              //   width: 3px;
              //   border-left: 0;
              //   border-top: 0;
              // }
            }
            .checkboxActive {
              color: $main-color;
            }
          }
          .active {
            background: $main-color;
            border-radius: 0 8px 8px 0;
            .list-item-name {
              color: #fff;
            }
          }
          .multiple-active {
            background-color: #e4e9f1;
            border-radius: 0 8px 8px 0;
          }
        }
        .clear {
          padding: 12px 0 12px 14px;
          cursor: pointer;
          color: #999999;
          display: flex;
          align-items: center;
          &-text {
            padding-left: 6px;
          }
        }
      }
      .preview-wrap {
        flex: 1;
        min-width: 900px;
        overflow-x: auto;
        .preview-content {
          height: calc(100% - 90px);
          margin: 16px 12px 0 12px;
          border: 1px solid #e8eefa;
          border-bottom: none;
          border-radius: 10px 10px 0 0;
          overflow: hidden;
          position: relative;
          background-color: #fff;
          .preview-text {
            position: absolute;
            background: #fff;
            z-index: 99;
            width: 53px;
            height: 30px;
            line-height: 30px;
            text-align: center;
            top: 0;
            left: 0;
            border-radius: 10px 0px 13px 0px;
            background-color: #eaedf4;
            color: #222;
          }
          .empty {
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 16px;
            height: 100%;
            color: #a9a9a9;
          }
        }
        .shadow {
          height: calc(100% - 144px);
          box-shadow: #b3d0f5 0px -10px 12px -14px inset;
        }
        .footer-wrapper {
          height: 60px;
          border-left: 1px solid #e8eefa;
          border-right: 1px solid #e8eefa;
          margin: 0 12px 0 12px;
          .footer {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 58px;
            background-color: #fff;
            .download-btn {
              display: block;
              padding: 10px 32px;
              border-radius: 5px;
              font-size: 16px;
              font-family: PingFangSC-Medium, PingFang SC;
              cursor: pointer;
              user-select: none;
            }
            .multiple {
              background-color: #fff;
              color: $main-color;
              border: 1px solid $main-color;
            }
            .single {
              color: #fff;
              margin-left: 16px;
              background: $main-color;
            }
            .producing {
              cursor: not-allowed;
            }
            .mr16 {
              margin-right: 16px;
            }
            .ml16 {
              margin-left: 16px;
            }
          }
        }
      }
      .preview-type {
        width: 153px;
        height: 202px;
        flex-shrink: 0;
        box-shadow: 0px 30px 32px -22px #d7e3f8 inset;
        background-color: #fff;
        .title {
          padding: 24px 15px 0 15px;
          font-size: 18px;
          color: #222222;
        }
        .all-type {
          margin: 12px 0 4px 16px;
        }
        .type-list {
          background-color: #fff;
          margin-top: 12px;
          &-item {
            padding: 6px 15px;
            margin: 10px 0;
            cursor: pointer;
            display: flex;
            &:hover {
              color: $main-color;
            }
            &-name {
              margin-left: 8px;
              color: #888888;
            }
          }
          .active {
            color: $main-color;
            background-color: #ebf1f7;
          }
        }
      }
    }
  }
}

.dot-ani {
  display: inline-block;
  height: 12px;
  line-height: 12px;
  overflow: hidden;
}
.dot-ani::after {
  display: inline-table;
  white-space: pre;
  content: "\A.\A..\A...";
  animation: spin 2s steps(4) infinite;
}
@keyframes spin {
  to {
    -webkit-transform: translateY(-48px);
    transform: translateY(-48px);
  }
}

::v-deep .el-scrollbar .el-scrollbar__wrap {
  overflow-x: hidden;
}

::v-deep .el-menu {
  width: 175px;
  border-right: 0px;
  background: #f5f5f5;
}
::v-deep .el-menu-item {
  padding-left: 60px !important;
  padding: 0;
  min-width: 145px;
  height: 41px;
  line-height: 41px;
  color: #999999;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 15px;
}
::v-deep .el-submenu__title {
  height: 41px;
  font-size: 16px;
  line-height: 41px;
  padding-left: 16px !important;
  color: #999999;
  background: #fff;
  // overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
::v-deep .el-menu-item.is-active {
  color: $main-color;
}
::v-deep .el-submenu.is-active > .el-submenu__title {
  color: #fff;
  padding-left: 9px !important;
  margin-left: 12px;
  background: $main-color;
  border-radius: 8px;
  &::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 41px;
    background: $main-color;
    position: absolute;
    left: -12px;
    border-radius: 8px;
  }
  .el-icon-arrow-down:before {
    color: #fff;
  }
}
::v-deep .el-tabs__content {
  border-left: 1px solid #e8e8e8;
  padding-left: 36px;
}
::v-deep.el-tabs--left .el-tabs__header.is-left {
  margin-right: 0;
}
::v-deep.el-tabs--left .el-tabs__item.is-left {
  text-align: left;
}
::v-deep .el-submenu__title > span {
  padding-left: 20px;
}
::v-deep .el-tabs__item {
  height: 48px;
}

.content {
  color: #222222;
  font-size: 13px;
  font-family: PingFangSC-Regular;
  display: flex;
  flex: 1;
  overflow-y: auto;
  height: calc(100vh - 150px);
  overflow-x: scroll;
  // border-left: 1px solid #eaedf7;
  &::-webkit-scrollbar {
    width: 4px;
    background-color: #fff;
    border-radius: 4px;

    height: 4px;
  }
  &::-webkit-scrollbar-thumb {
    background-color: #d8d8d8;
    border-radius: 4px;
  }
}

::-webkit-scrollbar {
  width: 4px;
  background-color: #fff;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb {
  background-color: #d8d8d8;
  border-radius: 4px;
}
::v-deep .el-textarea__inner::-webkit-scrollbar {
  width: 5px;
  background-color: #fff;
  border-radius: 4px;
}
::v-deep .el-textarea__inner::-webkit-scrollbar-thumb {
  background-color: #d8d8d8;
  border-radius: 4px;
}
::v-deep .el-submenu__title > span {
  padding-left: 0;
}
button:focus {
  outline: none;
}
button:hover {
  cursor: pointer;
}
::v-deep .el-date-editor .el-range-input {
  color: #999999;
  background-color: #fafcfe;
}
::v-deep .el-range-editor--small .el-range__icon {
  display: none;
}
::v-deep .el-checkbox {
  .el-checkbox__inner {
    border-radius: 3px;
    background: transparent;
    border-color: #9c9c9c;
  }
  .el-checkbox__input.is-checked .el-checkbox__inner {
    border-color: $main-color;
  }
  .el-checkbox__inner::after {
    border: 1px solid $main-color;
    border-left: 0;
    border-top: 0;
  }
}
</style>
